<?php if(!defined('A')) exit;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站内容管理系统</title>
<?php
loadcss(array('reset','shell'));
loadcss(array('colorbox'),P_CSS);
loadjs(array('jquery','jquery.colorbox'),P_JS);
loadjs(array('tab','util','table','ovalidator'));
loadjs(array('ueditor.config'));
loadjs(array('ueditor.all'),UEDITOR_URL);
?>
<script type="text/javascript">
$(document).ready(function(e) {
var smallNowTab;
var pt = new Tabs();
pt.classpre="smalltab_";
pt.container = "smalltab_container";
pt.createTab("t1","添加文章","",true,"n");
pt.init = function(){
	smallNowTab = pt.nowTab;
};
pt.onclick = function(){
	smallNowTab = pt.nowTab;
};		
pt.initTab();
pt.clickNowTab();    
});

//$(document).ready(function(){ 
//	UE.getEditor('event_trace');
//	UE.getEditor('technical_analysis');
//	UE.getEditor('related_events');
//	UE.getEditor('influence');
//	UE.getEditor('comment');
//	UE.getEditor('expert_opinion');
//});

$(document).ready(function(){ 
	$(".example1").colorbox({width:"400px", height:"400px", iframe:true, opacity:0.3});
	
	$("#check_title").click(function(){
		var t=$("#title").val();
		if(!t){
			alert('请填写标题！');
			return;	
		}else{
			$.post('<?php echo url('arc','title_unique');?>',{title:t,id:''},function(data){
				if(parseInt(data[0])){
					alert('标题可以使用！');
				}else{
					alert('标题被占用，请更换其它名称！');	
				}
			},'json');
		}
	});
});

function abc(f){
		$('#thumb').val(f);
}

$(document).ready(function(){
	oValidator.add([
		{id:'title',name:'标题',error:'不能为空',empty:false},
		{id:'content',name:'正文',error:'不能为空',empty:false},
		{id:'mysort',name:'排序',error:'不能为空',empty:false}
	]); 	
	$('#myform').submit(function(){
		if(!oValidator.pass()){
			alert(oValidator.error_str('\n'));
			return false;
		}
	});
});

</script>
<style>
body{margin:10px;}
</style>
</head>
<body>
<table class="settop">
<tr>
<td class="settop_left">
&nbsp;&nbsp;
</td>
<td>
<div id="smalltab_container"></div>
</td>
</tr>
</table>
<div class="smalltab_line"></div>
<div id="t1">
<br />
<br />
<form action="<?php echo url('arc','add_');?>" method="post" id="myform">
<table width="90%" border="0" cellspacing="0" cellpadding="0" class="mytable">
  <tr>
    <td align="right"><span class="red">所属分类：</span></td>
    <td align="left">
        <select name="arccat_id" id="">
            <option value="">--选择分类--</option>
            <?php foreach ($category_arr as $key => $value) { ?>
            <option <?php if($selected_c==$value['id']) echo 'selected="selected"';?> value="<?php echo $value['id'] ?>" <?php if($value['type']==1) echo 'disabled="disabled"';?>><?php echo str_repeat('&nbsp;',substr_count($value['path'], ',')*4)?>┖─&nbsp;<?php echo $value['name'] ?></option>
            <?php } ?>
        </select>
    </td>
  </tr>
  <tr>
    <td align="right"><span class="red">标题：</span></td>
    <td align="left"><input type="text" name="title" id="title" class="input" /><span class="green">(最长为500字符)</span>&nbsp;<input id="check_title" type="button" value="检测重复" /></td>
  </tr>
  <tr>
    <td align="right">属性：</td>
    <td align="left">
    <select name="flag">
    <?php echo form_select($flag_data,0);?>
    </select>
    </td>
  </tr>
  <tr>
    <td align="right">缩略图：</td>
    <td align="left"><input type="text" name="thumb" id="thumb" class="input" /> [<a class="example1" href="<?php echo url('upload','add','callback=abc');?>">上传</a>]</td>
  </tr>
  <tr>
    <td align="right">TAG属性：</td>
    <td align="left"><input name="tagattr" type="text" class="input" value="" /><span class="green">(标签之间用英文逗号分隔,单个标签长度不超过30字符)</span></td>
  </tr>
  <tr>
    <td align="right">描述：</td>
    <td align="left"><textarea name="description" id="description" cols="50" rows="4"></textarea><span class="green">(最长为300字符)</span></td>
  </tr>
  <tr>
    <td align="right">正文：</td>
    <td align="left"><textarea name="content" id="content" cols="100" rows="6"></textarea></td>
  </tr>
  <tr>
    <td align="right">添加人：</td>
    <td align="left"><input name="add_man" type="text" class="input" value="" /><span class="green">(最长为20字符)</span></td>
  </tr>
  <tr>
    <td align="right">添加时间：</td>
    <td align="left"><input name="add_time" type="hidden" value="<?php echo time();?>" />系统自动记录</td>
  </tr>
  <tr>
    <td align="right">作者：</td>
    <td align="left"><input name="author" class="input" type="text" value="" /><span class="green">(最长为20字符)</span></td>
  </tr>
  <tr>
    <td align="right">来源：</td>
    <td align="left"><input name="source" type="text" class="input" value="" /><span class="green">(最长为50字符)</span></td>
  </tr>
  <tr>
    <td align="right">来源网址：</td>
    <td align="left"><input name="sourceurl" type="text" class="input" value="" /><span class="green">(最长为255字符)</span></td>
  </tr>
  <tr>
    <td align="right">状态：</td>
    <td align="left"><?php echo form_radio('status',array(1=>'显示',0=>'隐藏'),1);?></td>
  </tr>
  <tr>
    <td align="right">排序：</td>
    <td align="left"><input type="text" name="mysort" id="mysort" class="input" value="<?php echo $mysort;?>" /><span class="green">(正整数，越小越靠前)</span></td>
  </tr>
  <tr>
    <td align="right">允许评论：</td>
    <td align="left"><?php echo form_radio('allowcomment',array(1=>'允许',0=>'不允许'),1,'y_');?></td>
  </tr>
  <tr>
    <td align="right">自定义模板：</td>
    <td align="left">
    <select name="template" id="template">
    <?php echo $this->s_0->my_template('');?>
    </select>
    </td>
  </tr>
  <tr>
    <td align="right">自定义文件名：</td>
    <td align="left"><input type="text" name="filepath" id="filepath" class="input" value="" /></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><input type="submit" name="submit" value="提交" class="color_btn color_btn_green" /></td>
    </tr>
</table>
</form>
</div>
</body>
</html>